﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Xna.Framework;

namespace Talkng_head
{
    class HeadControl : GraphicsDeviceControl //headControl dziedziczy po GraphicsDeviceControl
    {
        Head head = null;

        protected override void Initialize()
        {
            // Hook the idle event to constantly redraw our animation.
            Application.Idle += delegate { Invalidate(); }; //przerysowywanie animacji
        }

        public void LoadFemaleHead() //tworzy klasę FemaleHead
        {
            head = new FemaleHead(this.Services);
        }

        public void LoadMaleHead()
        {
            head = new MaleHead(this.Services); //klasa MaleHead
        }

        /// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            // Clear to the default control background color.
            GraphicsDevice.Clear(Color.LightBlue);
            if (head != null)
            {
                head.Draw(GraphicsDevice); //jeżeli mamy jakąś głowę to on ma ją rysować
            }
        }
    }
}
